{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from gs_quant.instrument import EqOption, OptionType, OptionStyle\n",
    "from gs_quant.session import Environment, GsSession\n",
    "import gs_quant.risk as risk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# external users should substitute their client id and secret\n",
    "GsSession.use(Environment.PROD, client_id=None, client_secret=None, scopes=('run_analytics',))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# create eq option\n",
    "eq_option = EqOption(\n",
    "    '.STOXX50E',\n",
    "    expiration_date='3m',\n",
    "    strike_price='ATMS',\n",
    "    option_type=OptionType.Call,\n",
    "    option_style=OptionStyle.European,\n",
    ")\n",
    "eq_option.as_dict()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# single measure\n",
    "dollar_delta = eq_option.calc(risk.EqDelta)\n",
    "dollar_delta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "Metrics - Equity Risks"
    ]
   },
   "outputs": [],
   "source": [
    "# multiple measures\n",
    "risks = eq_option.calc((risk.EqDelta, risk.EqGamma, risk.EqVega))\n",
    "risks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "Results - slice multi risk results"
    ]
   },
   "outputs": [],
   "source": [
    "# result for a single measure\n",
    "risks[risk.EqDelta]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "Metrics - parameterized currency"
    ]
   },
   "outputs": [],
   "source": [
    "# single measure with parameterized currency\n",
    "euro_delta = eq_option.calc(risk.EqDelta(currency='EUR'))\n",
    "euro_delta"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
